package com.yanqu.road.server.logic.bag;

import com.yanqu.road.entity.bag.UseGoodsResult;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.fivehero.FiveHeroModule;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;

public class UseRecoverFiveHeroHpPower extends BaseUseGoods {

    public UseRecoverFiveHeroHpPower(GamePlayer player, GoodsInfo goodsInfo, long param) {
        super(player, goodsInfo, param);
    }

    @Override
    int checkUse(long count) {
        if(!SystemOpenMgr.systemOpen(player, eSystemId.FiveHeroActivity.getValue())){
            return GameErrorCode.E_SYSTEM_NO_OPEN;
        }
        return 0;
    }

    @Override
    UseGoodsResult executeUse(long count) {
        long reValue = goodsInfo.getParamList().get(0).longValue();
        //不会没配吧我日，没配就恢复1
        if(reValue == 0){
            reValue = 1;
        }
        player.getModule(FiveHeroModule.class).pvpHpAdd( reValue * count);
        return new UseGoodsResult();
    }
}
